﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administrator/Site1.Master" AutoEventWireup="true"
    CodeBehind="ManagerNews.aspx.cs" Inherits="TIS.Administrator.ManagerNews" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="workplace">
        <div>
         <b>Chọn ngôn ngữ: </b><asp:DropDownList runat="server" ID="ddlLanguage"></asp:DropDownList> 
         <asp:Button ID="btnShowLanguage" class="btn" runat="server" Height="30px" 
                Text="Chọn ngôn ngữ" onclick="btnShowLanguage_Click"  />
         </div>
         <div class="dr">
            <span></span>
        </div>
        <div>
         <b>Lọc tin theo danh mục: </b><asp:DropDownList runat="server" ID="ddlCategory" 
                AutoPostBack="True" onselectedindexchanged="ddlCategory_SelectedIndexChanged"></asp:DropDownList> 
            
         <div class="dr">
            <span></span>
        </div>
        <asp:Button ID="Button1" CssClass="btn" Height="32px" PostBackUrl="/Administrator/ManagerCat.aspx" runat="server" Text="Thêm mới danh mục" />
        <asp:Button ID="Button2" CssClass="btn" Height="32px" PostBackUrl="/Administrator/AddNews.aspx" runat="server" Text="Thêm mới tin tức" />
        <div class="row-fluid">
            <div class="span12">
                <div class="head">
                    <h1>
                        Danh sách tin tức</h1>
                    <div class="clear">
                    </div>
                </div>
                <div class="block-fluid table-sorting">
                    <div class="row-form">
                        <asp:GridView ID="gridViewNews" runat="server" AutoGenerateColumns="False" CellPadding="4"
                            ForeColor="#333333" GridLines="None" Width="100%" AllowPaging="True" onpageindexchanging="gridViewNews_PageIndexChanging" 
                            >
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                            <Columns>
                                <asp:TemplateField HeaderText="Hình Ảnh">
                                    <ItemTemplate>
                                        <a target="_blank" href='<%# LinkUtil.linkNews(Eval("NewsID").ToString(),Eval("CategoryId").ToString(),Eval("NewsSEOUrl").ToString()) %>'>
                                            <img height="50px" width="50px" src='<%# Eval("NewsImages") %>' />
                                        </a>
                                        
                                         
                                    </ItemTemplate>
                                    <ControlStyle Height="50px" Width="50px" />
                                        <ItemStyle Height="50px" Width="50px" HorizontalAlign="Center" />
                                </asp:TemplateField>
                               
                                
                                <asp:TemplateField HeaderText="Tiêu đề">
                                    <ItemTemplate>
                                        <a target="_blank" href='<%# LinkUtil.linkNews(Eval("NewsID").ToString(),Eval("CategoryId").ToString(),Eval("NewsSEOUrl").ToString()) %>'><%# Eval("NewsTitle") %></a>
                                        
                                        
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="150px"></ItemStyle>
                                </asp:TemplateField>
                                <asp:BoundField DataField="CategoryName" HeaderText="Danh mục">
                                <ItemStyle HorizontalAlign="Center" Width="150px" />
                                </asp:BoundField>
                            
                                 <asp:TemplateField HeaderText="Thời gian">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTime" runat="server" 
                                            Text='<%# Eval("NewsDate","{0:dd/MM/yyyy | HH:mm}") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tình trạng">
                                    <ItemTemplate>
                                        <asp:Label ID="lblStatus" runat="server" 
                                            Text='<%# Convert.ToInt32(Eval("NewsStatus")) == 1 ? "Hoạt động" : "Không hoạt động" %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="150px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Hành động">
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                    <asp:LinkButton ID="lbtnEdit" runat="server" CommandArgument='<%# Eval("NewsId") %>'
                                            OnCommand="lbtnEdit_Command">Sửa</asp:LinkButton>
                                       
                                        &nbsp;|
                                         <asp:LinkButton ID="lbtnRemove" runat="server" CommandArgument='<%# Eval("NewsId") %>'
                                            OnClientClick="return confirm('Bạn có thực sự muốn xóa không ?')" 
                                            OnCommand="lbtnRemove_Command"><%# Convert.ToInt32(Eval("NewsId").ToString()) == 1 ? "" : "Xóa" %></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <EditRowStyle BackColor="#999999" />
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#E9E7E2" />
                            <SortedAscendingHeaderStyle BackColor="#506C8C" />
                            <SortedDescendingCellStyle BackColor="#FFFDF8" />
                            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                        </asp:GridView>
                    </div>
                    <div class="clear">
                    </div>
                </div>
            </div>
        </div>
     
    </div>
</asp:Content>
